package ru.ipccenter.belovseregas.point;

import ru.ipccenter.belovseregas.world.World;
import ru.ipccenter.belovseregas.robot.Robot;
import java.util.ArrayList;

public class Point {
	World world;
	int x;
	int y;
	ArrayList<Robot> robots;

	public Point() {
		world = null;
		x = 0;
		y = 0;
		robots = new ArrayList<Robot>();
	}
	
	public Point(World world, int x, int y) {
		this.world = world;
		this.x = x;
		this.y = y;
		robots = new ArrayList<Robot>();
	}

	public World getWorld() {
		return world;
	}

	public void setWorld(World world) {
		this.world = world;
	}

	public int getX() {
		return x;
	}

	public void setX(int x) {
		this.x = x;
	}

	public int getY() {
		return y;
	}

	public void setY(int y) {
		this.y = y;
	}

	public ArrayList<Robot> getRobots() {
		return robots;
	}

	public void setRobots(ArrayList<Robot> robots) {
		this.robots = robots;
	}

	
	public void addRobot(Robot robot) {
		robots.add(robot);
	}
	
	public void delRobot(Robot robot) {
		robots.remove(robot);
	}
	
	public void incrementX(int value) {
	    x += value;	
	}
	
	public void incrementY(int value) {
		y += value;
	}
	
	public int robotsNumber() {
		return robots.size();
	}
	
	public void delAllRobots() {
	    int i;
	    for (i = 0; i < robots.size(); i++) {
	    	world.delRobot(robots.get(i));
	    }
	    robots.clear();
	}
	
}
